<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<title>防沉迷设置</title>
<script src="/socket.io.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
    $(function(){
        let club, roomid,seatIndex, userId,lastMopai,endAccount;
        let openBtn  = $("#openBtn");
        let setPointBtn = $("#setPointBtn")
        let wallowBtn = $("#wallowBtn")
        let wallowRecordBtn = $("#wallowRecordBtn")
        var socket = io("127.0.0.1:32510"); //通过ip和端口建立一个socket client
        let num = 0;
        let clubId = 657848;
        socket.on('connect', function(){
            console.log('connect a socket client');
        });
        setPointBtn.click(function(){
            console.log("设置点数")
            socket.emit("club_set_user_point", {
                clubId,
                userId:138161,
                point:100
            })
        })

        openBtn.click(function(){
            console.log("111111111111");
            let userId = +$("#userId").val();
            socket.emit("open", {
                userId : userId
            });
        })
      
        socket.on("open_result", function(data){
            console.log("-----open_result----");
            console.log(data);
        })
        //设置点数
        socket.on("club_set_user_point_result", function(data){
            console.log("设置点数回执");
            console.log(data);
        }) 
        //防沉迷状态
        wallowBtn.click(function(){
            console.log("设置防沉迷状态")
            socket.emit("club_wallow_state_update",{
                clubId,
                wallow:0
            })
        })
        //防沉迷记录
        wallowRecordBtn.click(function(){
            console.log("防沉迷记录")
            socket.emit("club_user_point_page",{
                clubId,
            })
        })
        socket.on("club_wallow_state_update_result", function(data){
            console.log("-----------防沉迷回执-----------")
            console.log(data);
        })
        socket.on("club_user_point_page_result", function(data){
            console.log("-----------防沉迷记录-----------")
            console.log(data);
        })
        socket.on("system_error", function(data){
            console.log("--------system_error---------");
            console.log(data);
        });
    })
</script>
</head>
<body>
    <input type="text" name="userId" id="userId" value="138549"/> 
    <input id="openBtn" type="button" value="open"/></br>
    <input id="setPointBtn" type="button" value="设置点数"/></br>
    <input id="wallowBtn" type="button" value="防沉迷状态切换"/></br>
    <input id="wallowRecordBtn" type="button" value="防沉迷记录"/></br>
</body>
</html>
